package com.consumer.config;

import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.listener.api.RabbitListenerErrorHandler;
import org.springframework.amqp.rabbit.listener.exception.ListenerExecutionFailedException;
import org.springframework.stereotype.Component;

@Component("rabbitConsumerListenerErrorHandler")
public class RabbitConsumerListenerErrorHandler implements RabbitListenerErrorHandler {
	@Override
	public Object handleError(Message amqpMessage, org.springframework.messaging.Message<?> message,
			ListenerExecutionFailedException exception) throws Exception {
		System.out.println("消费失败的异常是:"+amqpMessage.getMessageProperties().getConsumerQueue());
		return "此处应该做消费重新消费，或者发送到死信交换机";
	}
}
